<%@ page contentType="text/html; charset=UTF-8"%>
<%@include file="/html/portlet/chart/datasourcecfg/init.jsp"%>

<%
	String redirect = ParamUtil.getString(request, "redirect");	
DataSourceCfg dsc = null;
	long dataSourceId = ParamUtil.getLong(request, "dataSourceId");
	if (dataSourceId > 0) {
		dsc = DataSourceCfgLocalServiceUtil.getDataSourceCfg(dataSourceId);
	}
%>
<portlet:actionURL name='addOrUpdateDataSourceCfg' var="editDataSourceCfgURL" />


<liferay-ui:header
	backURL="<%= redirect %>"
	localizeTitle="<%= (dsc == null) %>"
	title='<%= (dsc == null) ? "chart.dsconfig.new" : dsc.getName() %>'
/>
<aui:form action="<%= editDataSourceCfgURL %>" name="<portlet:namespace />fm">
	<aui:model-context bean="<%= dsc %>" model="<%= DataSourceCfg.class %>" />
	<aui:input type="hidden" name="dataSourceId" />
	<aui:input name="name" required="true" />
	<aui:input name="description" type="textarea" />
	<aui:input name="driver" required="true" label="chart.dsconfig.driver"/>
	<aui:input name="connUrl" required="true" label="chart.dsconfig.connUrl"/>
	<aui:input name="dbusername" required="true" label="chart.dsconfig.dbusername"/>
	<aui:input name="dbpassword" required="true" type="password" label="chart.dsconfig.dbpassword" value="<%= (dsc == null) ? StringPool.BLANK : dsc.getDbpassword() %>"/>
	
	<aui:button type="submit" />
	<aui:button href="<%=redirect %>" value='<%= LanguageUtil.get(pageContext, "cancel") %>'/>
</aui:form>
